1 #If _MyType <> "Empty" Then
5 ''' Module used to define the properties that are available in the My Namespace for WPF
7 ''' <remarks></remarks>
8 <Global.Microsoft.VisualBasic.HideModuleName()> _
10 Private s_Computer As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.Devices.Computer)
11 Private s_User As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.ApplicationServices.User)
12 Private s_Windows As New ThreadSafeObjectProvider(Of MyWindows)
13 Private s_Log As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.Logging.Log)
15 ''' Returns the application object for the running application
17 <Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
18 Friend ReadOnly Property Application() As Application
20 Return CType(Global.System.Windows.Application.Current, Application)
24 ''' Returns information about the host computer.
26 <Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
27 Friend ReadOnly Property Computer() As Global.Microsoft.VisualBasic.Devices.Computer
29 Return s_Computer.GetInstance()
33 ''' Returns information for the current user. If you wish to run the application with the current
34 ''' Windows user credentials, call My.User.InitializeWithWindowsUser().
36 <Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
37 Friend ReadOnly Property User() As Global.Microsoft.VisualBasic.ApplicationServices.User
39 Return s_User.GetInstance()
43 ''' Returns the application log. The listeners can be configured by the application's configuration file.
45 <Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
46 Friend ReadOnly Property Log() As Global.Microsoft.VisualBasic.Logging.Log
48 Return s_Log.GetInstance()
53 ''' Returns the collection of Windows defined in the project.
55 <Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
56 Friend ReadOnly Property Windows() As MyWindows
57 <Global.System.Diagnostics.DebuggerHidden()> _
59 Return s_Windows.GetInstance()
62 <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Never)> _
63 <Global.Microsoft.VisualBasic.MyGroupCollection("System.Windows.Window", "Create__Instance__", "Dispose__Instance__", "My.MyWpfExtenstionModule.Windows")> _
64 Friend NotInheritable Class MyWindows
65 <Global.System.Diagnostics.DebuggerHidden()> _
66 Private Shared Function Create__Instance__(Of T As {New, Global.System.Windows.Window})(ByVal Instance As T) As T
67 If Instance Is Nothing Then
68 If s_WindowBeingCreated IsNot Nothing Then
69 If s_WindowBeingCreated.ContainsKey(GetType(T)) = True Then
70 Throw New Global.System.InvalidOperationException("The window cannot be accessed via My.Windows from the Window constructor.")
73 s_WindowBeingCreated = New Global.System.Collections.Hashtable()
75 s_WindowBeingCreated.Add(GetType(T), Nothing)
77 s_WindowBeingCreated.Remove(GetType(T))
82 <Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1822:MarkMembersAsStatic")> _
83 <Global.System.Diagnostics.DebuggerHidden()> _
84 Private Sub Dispose__Instance__(Of T As Global.System.Windows.Window)(ByRef instance As T)
87 <Global.System.Diagnostics.DebuggerHidden()> _
88 <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Never)> _
92 <Global.System.ThreadStatic()> Private Shared s_WindowBeingCreated As Global.System.Collections.Hashtable
93 <Global.System.ComponentModel.EditorBrowsable(Global.System.ComponentModel.EditorBrowsableState.Never)> Public Overrides Function Equals(ByVal o As Object) As Boolean
94 Return MyBase.Equals(o)
96 <Global.System.ComponentModel.EditorBrowsable(Global.System.ComponentModel.EditorBrowsableState.Never)> Public Overrides Function GetHashCode() As Integer
97 Return MyBase.GetHashCode
99 <Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1822:MarkMembersAsStatic")> _
100 <Global.System.ComponentModel.EditorBrowsable(Global.System.ComponentModel.EditorBrowsableState.Never)> _
101 Friend Overloads Function [GetType]() As Global.System.Type
102 Return GetType(MyWindows)
104 <Global.System.ComponentModel.EditorBrowsable(Global.System.ComponentModel.EditorBrowsableState.Never)> Public Overrides Function ToString() As String
105 Return MyBase.ToString
110 Partial Class Application
111 Inherits Global.System.Windows.Application
112 <Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
113 <Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1822:MarkMembersAsStatic")> _
114 Friend ReadOnly Property Info() As Global.Microsoft.VisualBasic.ApplicationServices.AssemblyInfo
115 <Global.System.Diagnostics.DebuggerHidden()> _
117 Return New Global.Microsoft.VisualBasic.ApplicationServices.AssemblyInfo(Global.System.Reflection.Assembly.GetExecutingAssembly())